package com.icehand.exception;

import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartException;

import javax.servlet.http.HttpServletRequest;

/**
 * Controller cause exception ,it work
 * Created by icehand on 2017/5/11.
 */
@ControllerAdvice
public class GlobalDefaultExceptionHandler {
	@ExceptionHandler(value = Exception.class)
	public String defaultErrorHandler(HttpServletRequest request ,Exception e){
		if(AnnotationUtils.findAnnotation(e.getClass(), ResponseStatus.class) != null){

		}
		e.printStackTrace();
		System.out.println("error"+e);
		return "error";
	}

}
